<template>
  <div>
    <Input v-model="currentValue" v-if="editable" @input="handleInput"></Input>
    <div v-else>{{ currentValue }}</div>
  </div>
</template>
<script>
export default {
  name: 'CellEditable',
  data() {
    return {
      currentValue: this.value
    }
  },
  props: {
    value: {
      type: [String, Number]
    },
    editable: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    handleInput(value) {
      this.$emit('on-input', this.currentValue)
    }
  }
}

</script>
